package windbell.domain.risk.impl;

import edu.fudan.langlab.domain.code.impl.CodeImpl;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import windbell.domain.risk.RiskCause;
import windbell.domain.risk.proxy.RiskCauseProxy;

@Entity
@DiscriminatorValue("RISKCAUSE_TYPE")
public class RiskCauseImpl extends CodeImpl implements RiskCause {
  public RiskCauseImpl() {
    super();
  }
  
  public static RiskCause create(final IObjectFactory objectFactory) {
    windbell.domain.risk.RiskCause riskCause = new windbell.domain.risk.impl.RiskCauseImpl(
    );
    objectFactory.create(riskCause);
    return riskCause;			
    
  }
  
  public static RiskCause createRiskCauseImpl(final IObjectFactory objectFactory, final Procedure1<RiskCause> init) {
    windbell.domain.risk.RiskCause riskCause = new windbell.domain.risk.impl.RiskCauseImpl(
    );
    objectFactory.create(riskCause);
    init.apply(riskCause);
    return riskCause;			
    
  }
  
  public RiskCauseProxy toProxy() {
    windbell.domain.risk.proxy.RiskCauseProxy proxy = new windbell.domain.risk.proxy.RiskCauseProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
